*********************************************************************************************************************** ** Human Development Report Office (HDRO), United Nations Development Programme ** Multidimensional Poverty Index 2022 release ** Methodology developed in partnership with the Oxford Poverty and Human Development Initiative, University of Oxford ************************************************************************************************************************ clear all set more off set maxvar 10000 set mem 500m *** Working Folder Path *** global path_in "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA" global path_out "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA" ******************************************************************************** *** Ecuador ENSANUT 2018 *** ******************************************************************************** ******************************************************************************** *** Step 1: Data preparation *** Selecting variables from KR, BR, IR, & MR recode & merging with PR recode ******************************************************************************** /*Ecuador ENSANUT 2018: Anthropometric information were recorded for all individuals aged 0-98 years. For the purpose of the global MPI, we have used nutrition data when the data is available for all individuals but up to the age of 70 years. */ ******************************************************************************** *** Step 1.1 Underweight, Stunting & Wasting for children 0-60 months in age ******************************************************************************** use "$path_in/1_BDD_ENS2018_f1_personas.dta", clear gen ind_id = id_per label var ind_id "Individual ID" duplicates report ind_id //No duplicates count * 168,747 individuals **Compute age in days for all members foreach var in f1_s7_2_2 f1_s7_2_1 f1_s7_2_3 f1_s7_3_2 f1_s7_3_1 f1_s7_3_3 { replace `var'=. if `var'==88 | `var'==8888 } gen bdate = mdy(f1_s7_2_2, f1_s7_2_1, f1_s7_2_3) replace bdate = mdy(f1_s7_2_2, 15, f1_s7_2_3) if bdate==. & f1_s7_2_2<. & f1_s7_2_3<. format bdate %td gen mdate = mdy(f1_s7_3_2, f1_s7_3_1, f1_s7_3_3) replace mdate = mdy(f1_s7_3_2, 15, f1_s7_3_3) if mdate==. & f1_s7_3_2<. & f1_s7_3_3<. format mdate %td gen age_days = (mdate-bdate) replace age_days = 0 if age_days<0 label var age_days "Age in days for all members" compare age_days edaddias if age_days<. gen age_months = (mdate-bdate)/30.4375 replace age_months = 0 if age_months<0 label var age_months "Age in months for all members" count if age_months <61 /* count children under 5 years: 20,924 children */ keep if age_months <61 /* keep only children under 5 years */ gen child = 1 //Generate identification variable for individuals under 5 *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: ***Source of ado file: http://www.who.int/childgrowth/software/en/ adopath + "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\WHO igrowup STATA\" *** We will now proceed to create three nutritional variables: *** weight-for-age (underweight), *** weight-for-height (wasting) *** height-for-age (stunting) /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Child Growth Standards are stored. Note that we use strX to specify the length of the path in string. If the path is long, you may specify str55 or more, so it will run. */ gen str100 reflib="C:\igrowup_stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA dataset containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file (datalab_z_r_rc and datalab_prev_rc)*/ gen str30 datalab = "ECU18" lab var datalab "Working file" *** Next check the variables that WHO ado needs to calculate the z-scores: *** sex, age, weight, height, measurement, oedema & child sampling weight *** Variable: SEX *** tab sexo, miss gen gender = sexo desc gender tab gender *** Variable: AGE *** sum age_days gen str6 ageunit = "days" label var ageunit "Days" *** Variable: BODY WEIGHT (KILOGRAMS) *** gen weight = (f1_s7_4_1 + f1_s7_4_2)/2 if f1_s7_4_3==. replace weight = (f1_s7_4_1 + f1_s7_4_2 + f1_s7_4_3)/3 if f1_s7_4_3<. bys f1_s7_1: sum weight sum weight *** Variable: HEIGHT (CENTIMETERS) *** gen height = (f1_s7_5_1 + f1_s7_5_2)/2 if f1_s7_5_3==. replace height = (f1_s7_5_1 + f1_s7_5_2 + f1_s7_5_3)/3 if f1_s7_5_3<. replace height = (f1_s7_6_1 + f1_s7_6_2)/2 if f1_s7_6_3==. & height==. replace height = (f1_s7_6_1 + f1_s7_6_2 + f1_s7_6_3)/3 if f1_s7_6_3<. & height==. bys f1_s7_1: sum height sum height *** Variable: MEASURED STANDING/LYING DOWN *** gen measure = "l" if f1_s7_5_1<. replace measure = "h" if f1_s7_6_1<. tab measure,m *** Variable: OEDEMA *** gen oedema=" " *** Variable: INDIVIDUAL CHILD SAMPLING WEIGHT *** gen sw = fexp desc sw summ sw /*We now run the command to calculate the z-scores with the adofile */ igrowup_restricted reflib datalib datalab gender age_days ageunit weight height measure oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores */ use "$path_out/ECU18_z_rc.dta", clear gen z_scorewa = _zwei replace z_scorewa = . if _fwei==1 lab var z_scorewa "z-score weight-for-age WHO" *** Standard MPI indicator *** //Takes value 1 if the child is under 2 stdev below the median & 0 otherwise gen underweight = (_zwei < -2.0) replace underweight = . if _zwei == . | _fwei==1 lab var underweight "Child is undernourished (weight-for-age) 2sd - WHO" tab underweight, m gen stunting = (_zlen < -2.0) replace stunting = . if _zlen == . | _flen==1 lab var stunting "Child is stunted (length/height-for-age) 2sd - WHO" tab stunting, m gen wasting = (_zwfl < - 2.0) replace wasting = . if _zwfl == . | _fwfl == 1 lab var wasting "Child is wasted (weight-for-length/height) 2sd - WHO" tab wasting, m tab stunting dcronica, m tab underweigh dglobal, m ta wasting daguda, m count if _fwei==1 | _flen==1 //Retain relevant variables: keep id_per ind_id child age* under* stunting* wasting* order id_per ind_id child age* under* stunting* wasting* sort id_per duplicates report id_per //Erase files from folder: erase "$path_out/ECU18_z_rc.xls" erase "$path_out/ECU18_prev_rc.xls" *erase "$path_out/ECU18_z_rc.dta" //Save a temp file for merging later: save "$path_out/ECU2018_child.dta", replace ******************************************************************************** *** Step 1.2 BMI-for-age for Young Children 61-228 age in months ******************************************************************************** use "$path_in/1_BDD_ENS2018_f1_personas.dta", clear *** Generate individual unique id variable required for data merging: tostring persona, replace forvalues i=1(1)9 { replace persona="0`i'" if persona=="`i'" } gen ind_id = id_hogar + persona label var ind_id "Individual ID" duplicates report ind_id //No duplicates **Compute age in days for all members foreach var in f1_s7_2_2 f1_s7_2_1 f1_s7_2_3 f1_s7_3_2 f1_s7_3_1 f1_s7_3_3 { replace `var'=. if `var'==88 | `var'==8888 } gen bdate = mdy(f1_s7_2_2, f1_s7_2_1, f1_s7_2_3) replace bdate = mdy(f1_s7_2_2, 15, f1_s7_2_3) if bdate==. & f1_s7_2_2<. & f1_s7_2_3<. format bdate %td gen mdate = mdy(f1_s7_3_2, f1_s7_3_1, f1_s7_3_3) replace mdate = mdy(f1_s7_3_2, 15, f1_s7_3_3) if mdate==. & f1_s7_3_2<. & f1_s7_3_3<. format mdate %td gen age_days = (mdate-bdate) replace age_days = 0 if age_days<0 label var age_days "Age in days for all members" compare age_days edaddias if age_days<. gen age_month = (mdate-bdate)/30.4375 replace age_month = 0 if age_month<0 label var age_month "Age in months for all members" count if age_month>=61 & age_month<229 keep if age_month>=61 & age_month<229 count * 44,692 individuals 61-228 age in months ***Variables required to calculate the z-scores to produce BMI-for-age: *** Variable: SEX *** tab sexo, miss clonevar sex = sexo *** Variable: AGE IN MONTHS *** sum age_month gen str6 ageunit="months" lab var ageunit "months" *** Variable: BODY WEIGHT (KILOGRAMS) *** gen weight = (f1_s7_4_1 + f1_s7_4_2)/2 if f1_s7_4_3==. replace weight = (f1_s7_4_1 + f1_s7_4_2 + f1_s7_4_3)/3 if f1_s7_4_3<. bys f1_s7_1: sum weight sum weight *** Variable: HEIGHT (CENTIMETERS) *** gen height = (f1_s7_6_1 + f1_s7_6_2)/2 if f1_s7_6_3==. replace height = (f1_s7_6_1 + f1_s7_6_2 + f1_s7_6_3)/3 if f1_s7_6_3<. & height==. bys f1_s7_1: sum height sum height *** Variable: OEDEMA gen oedema = "n" tab oedema *** Variable: SAMPLING WEIGHT *** gen sw = fexp desc sw summ sw sort ind_id *** BMI-for-age for children 61-228 months *** *** Next, indicate to STATA where the igrowup_restricted.ado file is stored: ***Source of ado file: https://www.who.int/growthref/tools/en/ adopath + "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\WHO 2007 stata\" /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Growth reference are stored. Note that we use strX to specity the length of the path in string. */ gen reflib="C:\WHO 2007 Stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA data set containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "youth_nutri_ecu" lab var datalab "Working file" /*We now run the command to calculate the z-scores with the adofile */ who2007 reflib datalib datalab sex age_month ageunit weight height oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to compute BMI-for-age*/ use "$path_out/youth_nutri_ecu_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" *** Standard MPI indicator *** gen low_bmiage = (z_bmi < -2.0) /*Takes value 1 if BMI-for-age is under 2 stdev below the median & 0 otherwise */ replace low_bmiage = . if z_bmi==. lab var low_bmiage "Teenage low bmi 2sd - WHO" tab low_bmiage, miss gen youth = 1 * Individuals 61-228 age in months //Retain relevant variables: keep id_per ind_id age_month youth low_bmiage* order id_per ind_id age_month youth low_bmiage* sort id_per /*Append the nutrition information of children above 5 years with children under 5 */ append using "$path_out/ECU2018_child.dta" //Check appended information tab age_months, m ta age_month, m replace age_months = age_month if age_months==. & age_month<. drop age_month tab stunting if age_months<61, m tab low_bmiage if age_months>=61 & age_months<229, m //Save a temp file for merging later: save "$path_out/ECU2018_children.dta", replace //Erase files from folder: erase "$path_out/youth_nutri_ecu_z.xls" erase "$path_out/youth_nutri_ecu_prev.xls" *erase "$path_out/youth_nutri_ecu_z.dta" *erase "$path_out/ECU2018_child.dta" ******************************************************************************** *** Step 1.3 BMI for all individuals ******************************************************************************** use "$path_in/1_BDD_ENS2018_f1_personas.dta", clear *** Generate individual unique id variable required for data merging: gen ind_id = id_per label var ind_id "Individual ID" **Compute age in days for all members foreach var in f1_s7_2_2 f1_s7_2_1 f1_s7_2_3 f1_s7_3_2 f1_s7_3_1 f1_s7_3_3 { replace `var'=. if `var'==88 | `var'==8888 } gen bdate = mdy(f1_s7_2_2, f1_s7_2_1, f1_s7_2_3) replace bdate = mdy(f1_s7_2_2, 15, f1_s7_2_3) if bdate==. & f1_s7_2_2<. & f1_s7_2_3<. format bdate %td gen mdate = mdy(f1_s7_3_2, f1_s7_3_1, f1_s7_3_3) replace mdate = mdy(f1_s7_3_2, 15, f1_s7_3_3) if mdate==. & f1_s7_3_2<. & f1_s7_3_3<. format mdate %td gen age_days = (mdate-bdate) replace age_days = 0 if age_days<0 label var age_days "Age in days for all members" compare age_days edaddias if age_days<. gen age_months = (mdate-bdate)/30.4375 replace age_months = 0 if age_months<0 label var age_months "Age in months for all members" *** Variable: BODY WEIGHT (KILOGRAMS) *** gen weight = (f1_s7_4_1 + f1_s7_4_2)/2 if f1_s7_4_3==. replace weight = (f1_s7_4_1 + f1_s7_4_2 + f1_s7_4_3)/3 if f1_s7_4_3<. bys f1_s7_1: sum weight sum weight *** Variable: HEIGHT (CENTIMETERS) *** gen height = (f1_s7_5_1 + f1_s7_5_2)/2 if f1_s7_5_3==. replace height = (f1_s7_5_1 + f1_s7_5_2 + f1_s7_5_3)/3 if f1_s7_5_3<. replace height = (f1_s7_6_1 + f1_s7_6_2)/2 if f1_s7_6_3==. & height==. replace height = (f1_s7_6_1 + f1_s7_6_2 + f1_s7_6_3)/3 if f1_s7_6_3<. & height==. bys f1_s7_1: sum height sum height *** Variable: BMI MEASURE *** gen bmi = weight/((height/100)^2) tab age_months if bmi==., m bys f1_s7_1: sum bmi lab var bmi "BMI" gen low_bmi = (bmi<18.5) replace low_bmi=. if bmi==. lab var low_bmi "BMI <18.5" lab define lab_low_bmi 1 "bmi<18.5" 0 "bmi>=18.5" lab values low_bmi lab_low_bmi tab low_bmi, miss //Retain relevant variables: keep id_per ind_id bmi low_bmi* age_months age_days order id_per ind_id bmi low_bmi* age_months age_days sort id_per //Merge nutrition information from individuals under 20 years merge 1:1 id_per using "$path_out/ECU2018_children.dta" drop _merge sort id_per save "$path_out/ECU2018_nutri.dta", replace ******************************************** *** Step 1.4 HOUSEHOLD LEVEL INFORMATION ******************************************** use "$path_in/2_BDD_ENS2018_f1_hogar.dta", clear keep area prov upm id_viv id_hogar fecha_anio fecha_mes fecha_dia region fexp estrato f1_s1_3 f1_s1_4 f1_s1_5 f1_s1_9 f1_s1_10 f1_s1_13 f1_s1_14 f1_s1_15 f1_s1_16 f1_s1_17 f1_s1_18 f1_s1_19 f1_s1_20 f1_s1_21 f1_s1_22 f1_s1_23 f1_s1_24 f1_s1_25 f1_s1_26 f1_s1_27 f1_s1_28 f1_s1_29 f1_s1_30 f1_s1_31 f1_s1_32 f1_s1_44_1 f1_s1_44_1_1 f1_s1_44_2 f1_s1_44_2_1 f1_s1_44_7 f1_s1_44_7_1 f1_s1_44_10 f1_s1_44_10_1 f1_s1_44_11 f1_s1_44_11_1 foreach var in area prov upm id_viv fecha_anio fecha_mes fecha_dia region fexp estrato { ren `var' `var'_hogar } sort id_hogar save "$path_out/ECU2018_hogar.dta", replace ******************************************** *** Step 1.4 CHILD MORTALITY INFORMATION ******************************************** use "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA/4_BDD_ENS2018_f2_mef.dta", clear * 48,700 women 10-49 y keep id_per f2_s2_210 f2_s2_211_1 f2_s2_211_2 f2_s2_211_3 f2_s2_207 f2_s2_200 f2_s2_206 f2_s2_218-f2_s2_218_10_f3 fecha_mes fecha_dia fecha_anio *foreach var in area prov upm id_viv persona fecha_anio fecha_mes fecha_dia region etnia edadanios gedad_anios nivins fexp estrato { *ren `var' `var'_mef_br *} forvalues i=1(1)10 { ren f2_s2_218_`i'_1 f2_s2_218_1_`i' ren f2_s2_218_`i'_a f2_s2_218_a_`i' ren f2_s2_218_`i'_b1 f2_s2_218_b1_`i' ren f2_s2_218_`i'_b2 f2_s2_218_b2_`i' ren f2_s2_218_`i'_b3 f2_s2_218_b3_`i' ren f2_s2_218_`i'_c f2_s2_218_c_`i' ren f2_s2_218_`i'_d1 f2_s2_218_d1_`i' ren f2_s2_218_`i'_d2 f2_s2_218_d2_`i' ren f2_s2_218_`i'_e1 f2_s2_218_e1_`i' ren f2_s2_218_`i'_e2 f2_s2_218_e2_`i' ren f2_s2_218_`i'_f1 f2_s2_218_f1_`i' ren f2_s2_218_`i'_f2 f2_s2_218_f2_`i' ren f2_s2_218_`i'_f3 f2_s2_218_f3_`i' } reshape long f2_s2_218_1_ f2_s2_218_a_ f2_s2_218_b1_ f2_s2_218_b2_ f2_s2_218_b3_ f2_s2_218_c_ f2_s2_218_d1_ f2_s2_218_d2_ f2_s2_218_e1_ f2_s2_218_e2_ f2_s2_218_f1_ f2_s2_218_f2_ f2_s2_218_f3_, i(id_per) j(hijo) duplicates report id_per hijo keep if f2_s2_218_a_<. gen age_death = f2_s2_218_f3 replace age_death = . if age_death>=88 replace age_death = 0 if (f2_s2_218_f1_<=31 | f2_s2_218_f2<12) & f2_s2_218_f3>=88 replace age_death = 1 if f2_s2_218_f2==12 & f2_s2_218_f3>=88 gen age_deathd = age_death*365 replace f2_s2_218_b2_ = . if f2_s2_218_b2_==88 replace f2_s2_218_b1_ = . if f2_s2_218_b1_==88 replace f2_s2_218_b3_ = . if f2_s2_218_b3_==8888 | f2_s2_218_b3_==88 gen birthdate = mdy(f2_s2_218_b2_, f2_s2_218_b1_, f2_s2_218_b3_) replace birthdate = mdy(f2_s2_218_b2_, 15, f2_s2_218_b3_) if birthdate==. & f2_s2_218_b2_<. & f2_s2_218_b3_<. format birthdate %td replace f2_s2_218_e1=6 if f2_s2_218_e1==88 replace f2_s2_218_e2=. if f2_s2_218_e2==8888 gen deathdate = mdy(f2_s2_218_e1, 15, f2_s2_218_e2) format deathdate %td gen interviewdate = mdy(fecha_mes, fecha_dia, fecha_anio) format interviewdate %td gen ddead_survey = interviewdate - deathdate gen ydead_survey = ddead_survey/365 gen date_death = birthdate + age_deathd gen mdead_survey = interviewdate - date_death * Days dead from survey = Date of interview - date of death gen ydead_survey2 = mdead_survey/365 replace ydead_survey2 = 0 if ydead_survey2<0 replace ydead_survey = ydead_survey2 if ydead_survey==. & ydead_survey2<. gen child_died = 1 if f2_s2_218_c_==2 replace child_died = 0 if f2_s2_218_c_==1 label define lab_died 1 "child has died" 0 "child is alive" label values child_died lab_died tab f2_s2_218_c_ child_died, m bysort id_per: egen tot_child_died = sum(child_died) replace child_died=0 if age_death>=18 & age_death<. /* counting only deaths of children <18y */ replace child_died=0 if ydead_survey>5 & ydead_survey<. /* deaths that happened more than 5 years ago are not counted */ replace child_died=. if ydead_survey==. & child_died==1 /* deaths with missing date information are treated as missing */ bysort id_per: egen tot_child_died_5y=sum(child_died), missing /*if ydead_survey<=5*/ /*For each woman, sum the number of children who died in the past 5 years prior to the interview date */ *replace tot_child_died_5y=0 if tot_child_died_5y==. & tot_child_died>=0 & tot_child_died<. /*All children who are alive and died longer than 5 years from the interview date are replaced as '0'*/ *replace tot_child_died_5y=. if child_died==1 & ydead_survey==. *Replace as '.' if there is no information on when the child died *replace tot_child_died_5y=1 if f2_s2_218_b3_>=2013 & f2_s2_218_b3_<=2019 & tot_child_died_5y==. gen cc=1 if ydead_survey==. & f2_s2_218_c_==2 bys id_per: egen mm=max(cc) replace tot_child_died_5y=. if mm==1 & tot_child_died_5y==0 tab tot_child_died tot_child_died_5y, m bysort id_per: egen child_died_per_wom = max(tot_child_died) lab var child_died_per_wom "Total child death for each women (birth recode)" bysort id_per: egen child_died_per_wom_5y = max(tot_child_died_5y) lab var child_died_per_wom_5y "Total child death for each women in the last 5 years (birth recode)" //Keep one observation per women bysort id_per child_died_per_wom_5y: gen id=1 if _n==1 keep if id==1 drop id duplicates report id_per gen women_BR = 1 /* 30,900 women with at least one birth */ //Identification variable for observations in BR recode drop cc mm order id_per women_BR child_died_per_wom child_died_per_wom_5y sort id_per //Save a temp file for merging with PR: save "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA/Ecu20_BR.dta", replace use "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA/4_BDD_ENS2018_f2_mef.dta", clear * 48,700 women 10-49 y keep area prov upm id_viv id_hogar id_per persona fecha_anio fecha_mes fecha_dia region etnia edadanios gedad_anios nivins fexp estrato f2_s2_210 f2_s2_211_1 f2_s2_211_2 f2_s2_211_3 f2_s2_207 f2_s2_200 f2_s2_206 f2_s2_217_3 foreach var in area prov upm id_viv persona fecha_anio fecha_mes fecha_dia region etnia edadanios gedad_anios nivins fexp estrato { ren `var' `var'_mef } egen temp_f = rowtotal(f2_s2_211_1 f2_s2_211_2), missing compare f2_s2_211_3 temp /* they are identical */ drop temp_f replace f2_s2_210=2 if f2_s2_210==1 & f2_s2_217_3==0 /* data inconsistency */ gen child_died_mef = 1 if f2_s2_210==1 replace child_died_mef = 0 if f2_s2_210==2 /* no child died */ replace child_died_mef = 0 if f2_s2_207==2 /* never pregnant */ replace child_died_mef = 0 if f2_s2_206==1 /* first pregnancy */ gen child_died_per_wom_mef = child_died_mef lab var child_died_per_wom_mef "At least one child died (mef)" sort id_per merge id_per using "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA/Ecu20_BR.dta" ta _merge drop _merge save "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Ecuador 2018_ENSANUT\STATA//ECU2018_mef.dta", replace ******************************************************************************** *** Step 1.5 HOUSEHOLD MEMBER'S INFORMATION ******************************************************************************** use "$path_in/1_BDD_ENS2018_f1_personas.dta", clear gen ind_id = id_per label var ind_id "Individual ID" gen hh_id = id_hogar label var hh_id "Household ID" sort hh_id ind_id ******************************************************************************** *** 1.6 DATA MERGING ******************************************************************************** *** Merging Nutrition Data ************************************************* merge 1:1 id_per using "$path_out/ECU2018_nutri.dta" drop _merge *erase "$path_out/ECU2018_nutri.dta" sort id_per *** Merging Household Data ***************************************** merge m:1 id_per using "$path_out/ECU2018_mef.dta" drop _merge sort id_hogar merge m:1 id_hogar using "$path_out/ECU2018_hogar.dta" drop _merge erase "$path_out/ECU2018_hogar.dta" sort ind_id ******************************************************************************** *** 1.7 RENAMING DEMOGRAPHIC VARIABLES *** ******************************************************************************** //Sample weight desc fexp clonevar weight = fexp //Area: urban or rural replace area=0 if area==2 label define lab_area 1 "urban" 0 "rural" label values area lab_area label var area "Area: urban-rural" tab area, miss //Relationship to the head of household clonevar relationship = f1_s2_7 codebook relationship, tab (20) recode relationship (1=1)(2=2)(3=3)(4/7=4) (9=5) (8=6) (99=.) label define lab_rel 1"head" 2"spouse" 3"child" 4"extended family" 5"not related" 6"maid" label values relationship lab_rel label var relationship "Relationship to the head of household" tab f1_s2_7 relationship, miss //Sex of household member codebook sexo, tab (5) clonevar sex = sexo //Age of household member lookfor edad clonevar age = edadanios //Age group recode age (0/4 = 1 "0-4")(5/9 = 2 "5-9")(10/14 = 3 "10-14") (15/17 = 4 "15-17")(18/59 = 5 "18-59")(60/max=6 "60+"), gen(agec7) lab var agec7 "age groups (7 groups)" recode age (0/9 = 1 "0-9") (10/17 = 2 "10-17")(18/59 = 3 "18-59") (60/max=4 "60+"), gen(agec4) lab var agec4 "age groups (4 groups)" recode age (0/17 = 1 "0-17") (18/max = 2 "18+"), gen(agec2) lab var agec2 "age groups (2 groups)" //Marital status of household member gen marital = 1 if f1_s2_16==7 replace marital = 2 if f1_s2_16==1 | f1_s2_16==2 | f1_s2_16==3 replace marital = 3 if f1_s2_16==6 replace marital = 4 if f1_s2_16==5 replace marital = 5 if f1_s2_16==4 label define lab_mar 1"never married" 2"currently married" 3"widowed" 4"divorced" 5"not living together" label values marital lab_mar label var marital "Marital status of household member" tab f1_s2_16 marital, miss //Total number of de jure hh members in the household gen member = 1 bysort hh_id: egen hhsize = sum(member) label var hhsize "Household size" tab hhsize, miss drop member ** Ethnicity of the household head gen ethnic = etnia *recode ethnic (3=2)(4=2)(6=3)(5=4)(7=5)(8=6) *lab define ethnic_lab 1"Indigena" 2"Afroecuatoriano (afrodescendiente/negro/mulato)" 3"Mestizo" 4"Montubio" 5"Blanco" 6"Otro" *lab values ethnic ethnic_lab *tab ethnic etnia,m gsort hh_id f1_s2_7 -age ind_id clonevar ethnic_temp = ethnic if f1_s2_7==1 bys hh_id: gen oldest_temp=1 if _n==1 & ethnic<. replace ethnic_temp = ethnic if oldest_temp==1 & ethnic_temp==. bysort hh_id: egen ethnic_hh=max(ethnic_temp) label var ethnic_hh "Ethnicity of household head" lab values ethnic_hh ethnic_lab tab ethnic_hh,m ********************************************************** ** counting single versus multiple ethnicities households ** ********************************************************** gen ethnic_all=ethnic sort hh_id ethnic_all gen mc=1 if hh_id==hh_id[_n+1] & ethnic_all!=ethnic_all[_n+1] & ethnic_all<. & ethnic_all[_n+1]<. sort hh_id mc bysort hh_id: egen mc2=sum(mc) gen mc3=1 if mc2>0 & mc2<. ta mc3[aw=weight],m //Subnational region /*The sample is representative at the national, urban and rural levels, 4 natural regions, 24 provinces, 9 planning areas and 4 cities self-represented (Quito, Guayaquil, Cuenca and Machala) */ ta region,m ******************************************************************************** *** Step 2 Data preparation *** *** Standardization of the 10 Global MPI indicators *** Identification of non-deprived & deprived individuals ******************************************************************************** ******************************************************************************** *** Step 2.1 Years of Schooling *** ******************************************************************************** // In Ecuador, the education system: * Entrance age of primary: 6 years * Duration of primary: 6 years ta f1_s2_19_2 f1_s2_19_1, m gen eduyears=1 if f1_s2_19_2==1 & f1_s2_19_1==4 replace eduyears=2 if f1_s2_19_2==2 & f1_s2_19_1==4 replace eduyears=3 if f1_s2_19_2==3 & f1_s2_19_1==4 replace eduyears=4 if f1_s2_19_2==4 & f1_s2_19_1==4 replace eduyears=5 if f1_s2_19_2==5 & f1_s2_19_1==4 replace eduyears=6 if f1_s2_19_2==6 & f1_s2_19_1==4 replace eduyears=0 if f1_s2_19_2==0 & f1_s2_19_1==5 replace eduyears=1 if f1_s2_19_2==1 & f1_s2_19_1==5 replace eduyears=2 if f1_s2_19_2==2 & f1_s2_19_1==5 replace eduyears=3 if f1_s2_19_2==3 & f1_s2_19_1==5 replace eduyears=4 if f1_s2_19_2==4 & f1_s2_19_1==5 replace eduyears=5 if f1_s2_19_2==5 & f1_s2_19_1==5 replace eduyears=6 if f1_s2_19_2==6 & f1_s2_19_1==5 replace eduyears=7 if f1_s2_19_2==7 & f1_s2_19_1==5 replace eduyears=8 if f1_s2_19_2==8 & f1_s2_19_1==5 replace eduyears=9 if f1_s2_19_2==9 & f1_s2_19_1==5 replace eduyears=10 if f1_s2_19_2==10 & f1_s2_19_1==5 replace eduyears=7 if f1_s2_19_2==1 & f1_s2_19_1==6 replace eduyears=8 if f1_s2_19_2==2 & f1_s2_19_1==6 replace eduyears=9 if f1_s2_19_2==3 & f1_s2_19_1==6 replace eduyears=10 if f1_s2_19_2==4 & f1_s2_19_1==6 replace eduyears=11 if f1_s2_19_2==5 & f1_s2_19_1==6 replace eduyears=12 if f1_s2_19_2==6 & f1_s2_19_1==6 replace eduyears=11 if f1_s2_19_2==1 & f1_s2_19_1==7 replace eduyears=12 if f1_s2_19_2==2 & f1_s2_19_1==7 replace eduyears=13 if f1_s2_19_2==3 & f1_s2_19_1==7 replace eduyears=13 if f1_s2_19_2==1 & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=14 if f1_s2_19_2==2 & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=15 if f1_s2_19_2==3 & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=16 if f1_s2_19_2==4 & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=17 if f1_s2_19_2==5 & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=18 if (f1_s2_19_2==6 | f1_s2_19_2==7 | f1_s2_19_2==8) & (f1_s2_19_1==8 | f1_s2_19_1==9) replace eduyears=18 if f1_s2_19_2==1 & f1_s2_19_1==10 replace eduyears=19 if f1_s2_19_2==2 & f1_s2_19_1==10 replace eduyears=20 if f1_s2_19_2==3 & f1_s2_19_1==10 replace eduyears=21 if f1_s2_19_2==4 & f1_s2_19_1==10 replace eduyears=22 if f1_s2_19_2==5 & f1_s2_19_1==10 replace eduyears=0 if f1_s2_19_1==1 | f1_s2_19_1==2 | f1_s2_19_1==3 lab var eduyears "Highest year of education completed" tab eduyears f1_s2_19_1, m *** Cleaning inconsistencies replace eduyears = . if age<=eduyears & age>0 /*There are cases in which the years of schooling are greater than the age of the individual. This is clearly a mistake in the data. Please check whether this is the case and correct when necessary */ replace eduyears = 0 if age < 10 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 10 years or older */ replace eduyears = 0 if (age==10 | age==11) & eduyears < 6 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 12 years or older */ /*A control variable is created on whether there is information on years of education for at least 2/3 of the household members. */ gen temp = 1 if (eduyears!=. & (age>=12 & age!=.)) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen no_missing_edu = sum(temp) /*Total household members who are 12 years and older with no missing years of education but recognizing as an achievement if the member is 10 or 11 and already completed 6 yrs of schooling */ gen temp2 = 1 if (age>=12 & age!=.) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are 12 years and older replace no_missing_edu = no_missing_edu/hhs replace no_missing_edu = (no_missing_edu>=2/3) /*Identify whether there is information on years of education for at least 2/3 of the household members aged 12 years and older */ tab no_missing_edu, miss label var no_missing_edu "No missing edu for at least 2/3 of the HH members aged 12 years & older" drop temp temp2 hhs /*The entire household is considered deprived if no household member aged 12 years or older has completed SIX years of schooling. */ gen years_edu6 = (eduyears>=6) /* The years of schooling indicator takes a value of "1" if at least someone in the hh has reported 6 years of education or more */ replace years_edu6 = . if eduyears==. bysort hh_id: egen hh_years_edu6_1 = max(years_edu6) gen hh_years_edu6 = (hh_years_edu6_1==1) replace hh_years_edu6 = . if hh_years_edu6_1==. replace hh_years_edu6 = . if hh_years_edu6==0 & no_missing_edu==0 lab var hh_years_edu6 "Household has at least one member with 6 years of edu" ******************************************************************************** *** Step 2.2 Child School Attendance *** ******************************************************************************** lookfor asist gen attendance = f1_s2_17 replace attendance=0 if attendance==2 tab f1_s2_17 attendance, miss *** Standard MPI *** /*The entire household is considered deprived if any school-aged child is not attending school up to class 8. */ ******************************************************************* gen child_schoolage = (age>=6 & age<=14) /*A control variable is created on whether there is no information on school attendance for at least 2/3 of the school age children */ count if child_schoolage==1 & attendance==. //Understand how many eligible school aged children are not attending school gen temp = 1 if child_schoolage==1 & attendance!=. bysort hh_id: egen no_missing_atten = sum(temp) /*Total school age children with no missing information on school attendance */ gen temp2 = 1 if child_schoolage==1 bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are of school age replace no_missing_atten = no_missing_atten/hhs replace no_missing_atten = (no_missing_atten>=2/3) /*Identify whether there is missing information on school attendance for more than 2/3 of the school age children */ tab no_missing_atten, miss label var no_missing_atten "No missing school attendance for at least 2/3 of the school aged children" drop temp temp2 hhs bysort hh_id: egen hh_children_schoolage = sum(child_schoolage) replace hh_children_schoolage = (hh_children_schoolage>0) //Control variable: //It takes value 1 if the household has children in school age lab var hh_children_schoolage "Household has children in school age" gen child_not_atten = (attendance==0) if child_schoolage==1 replace child_not_atten = . if attendance==. & child_schoolage==1 bysort hh_id: egen any_child_not_atten = max(child_not_atten) gen hh_child_atten = (any_child_not_atten==0) replace hh_child_atten = . if any_child_not_atten==. replace hh_child_atten = 1 if hh_children_schoolage==0 replace hh_child_atten = . if hh_child_atten==1 & no_missing_atten==0 /*If the household has been intially identified as non-deprived, but has missing school attendance for at least 2/3 of the school aged children, then we replace this household with a value of '.' because there is insufficient information to conclusively conclude that the household is not deprived */ lab var hh_child_atten "Household has all school age children up to class 8 in school" tab hh_child_atten, miss /*Note: The indicator takes value 1 if ALL children in school age are attending school and 0 if there is at least one child not attending. Households with no children receive a value of 1 as non-deprived. The indicator has a missing value only when there are all missing values on children attendance in households that have children in school age. */ ******************************************************************************** *** Step 2.3 Nutrition *** ******************************************************************************** /*Note: Ecuador ENSANUT 2018: Anthropometric information were recorded for all individuals aged 0-98 years. This departs from the usual DHS surveys that tend to collect anthropometric data only from children under 5 and adults between the age group of 15-49/15-59 years. In the case of Ecuador, we make use of the anthropometric data for individuals aged 0 - 70 years only, even if the data is available for up to the age of 98 years. This is in line with the global MPI requirement. The age cut-off is captured in the final indicator through the eligibility criteria. */ *** Eligibility criteria for Nutrition *********************************************** gen nutri_eligible = age<=70 bysort hh_id: egen n_nutri_eligible = sum(nutri_eligible) gen no_nutri_eligible = (n_nutri_eligible==0) lab var no_nutri_eligible "Household has no eligible women, men, or children" tab no_nutri_eligible, m drop nutri_eligible n_nutri_eligible gen child_eligible = age_months<61 bysort hh_id: egen n_child_eligible = sum(child_eligible) gen no_child_eligible = (n_child_eligible==0) lab var no_child_eligible "Household has no eligible children <61 months" tab no_child_eligible, m drop child_eligible n_child_eligible gen adult = 1 if child==. & youth==. & f1_s7_1==1 ******************************************************************************** *** Step 2.3d Household Nutrition Indicator *** ******************************************************************************** gen nutri = 1 if stunting==1 | underweight==1 replace nutri = 0 if stunting==0 & underweight==0 tab nutri if child==1, m replace nutri = 1 if low_bmiage==1 & nutri==. & youth==1 replace nutri = 0 if low_bmiage==0 & nutri==. & youth==1 replace nutri = 1 if low_bmi==1 & low_bmiage==. & nutri==. & youth==1 replace nutri = 0 if low_bmi==0 & low_bmiage==. & nutri==. & youth==1 replace nutri = 1 if low_bmi==1 & nutri==. & adult==1 replace nutri = 0 if low_bmi==0 & nutri==. & adult==1 replace nutri = . if age>70 & age<. bysort id_hogar: egen temp = max(nutri) gen hh_nutrition_uw_st = (temp==0) replace hh_nutrition_uw_st = . if temp==. replace hh_nutrition_uw_st = 1 if no_nutri_eligible==1 /*We replace households that do not have the applicable population, that is, women and men up to 70 years and children under 5, as non-deprived in nutrition*/ lab var hh_nutrition_uw_st "Household has no child underweight/stunted or adult deprived by BMI/BMI-for-age" lab value hh_nutrition_uw_st lab_nutri tab hh_nutrition_uw_st, m ******************************************************************************** *** Step 2.4 Child Mortality *** ******************************************************************************** *** No Eligible Women 10-49 years ***************************************** gen fem_eligible = (age>=10 & age<=49 & sex==2) bys id_hogar: egen hh_n_fem_eligible = sum(fem_eligible) //Number of eligible women for interview in the hh gen no_fem_eligible = (hh_n_fem_eligible==0) //Takes value 1 if the household had no eligible females for an interview lab var no_fem_eligible "Household has no eligible women" tab no_fem_eligible, m * Total child mortality reported by eligible women gen women_MEF = 1 if region_mef<. gen temp_f = f2_s2_217_3 replace temp_f = 0 if temp_f==. & women_MEF==1 /* womwen that never gave birth */ bysort id_hogar: egen child_mortality_f = sum(temp_f), missing lab var child_mortality_f "Occurrence of child mortality reported by women" tab child_mortality_f, miss drop temp_f egen child_mortality = rowmax(child_mortality_f) lab var child_mortality "Total child mortality within household reported by women" tab child_mortality child_mortality_f, m /*Deprived if any children died in the household */ ************************************************************************ gen hh_mortality = (child_mortality==0) /*Household is replaced with a value of "1" if there is no incidence of child mortality*/ replace hh_mortality = . if child_mortality==. replace hh_mortality = 1 if no_fem_eligible==1 /*Change eligibility to "no_fem_eligible==1" if child mortality indicator is constructed solely using information from women */ lab var hh_mortality "Household had no child mortality" tab hh_mortality, m /*Deprived if any children died in the household in the last 5 years from the survey year */ ************************************************************************ tab child_died_per_wom_5y, m /* The 'child_died_per_wom_5y' variable was constructed in Step 1.2 using information from individual women who ever gave birth in the BR file. The missing values represent eligible woman who have never ever given birth and so are not present in the BR file. But these 'missing women' may be living in households where there are other women with child mortality information from the BR file. So at this stage, it is important that we aggregate the information that was obtained from the BR file at the household level. This ensures that women who were not present in the BR file is assigned with a value, following the information provided by other women in the household.*/ replace child_died_per_wom_5y=0 if child_died_per_wom_5y==. & women_MEF==1 & women_BR==. /* Assign a value of "0" for women who never ever gave birth */ replace child_died_per_wom_5y = 0 if no_fem_eligible==1 /* Assign a value of "0" for individuals living in households that have non-eligible women */ bysort id_hogar: egen child_mortality_5y = sum(child_died_per_wom_5y), missing label var child_mortality_5y "Total child mortality within household past 5 years reported by women" tab child_mortality_5y, m /* The new standard MPI indicator takes a value of "1" if eligible women within the household reported no child mortality or if any child died longer than 5 years from the survey year. The indicator takes a value of "0" if women in the household reported any child mortality in the last 5 years from the survey year. Households were replaced with a value of "1" if eligible men within the household reported no child mortality in the absence of information from women. The indicator takes a missing value if there was missing information on reported death from eligible individuals. */ gen hh_mortality_5y = (child_mortality_5y==0) replace hh_mortality_5y = . if child_mortality_5y==. tab hh_mortality_5y, m lab var hh_mortality_5y "Household had no child mortality in the last 5 years" ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** *** Standard MPI *** /*Members of the household are considered deprived if the household has no electricity */ *************************************************** gen electricity = 1 if f1_s1_10==1 | f1_s1_10==2 replace electricity = 0 if f1_s1_10==3 | f1_s1_10==4 label var electricity "Electricity" tab f1_s1_10 electricity, miss ******************************************************************************** *** Step 2.6 Sanitation *** ******************************************************************************** /* Improved sanitation facilities include flush or pour flush toilets to sewer systems, septic tanks or pit latrines, ventilated improved pit latrines, pit latrines with a slab, and composting toilets. These facilities are only considered improved if it is private, that is, it is not shared with other households. Source: https://unstats.un.org/sdgs/metadata/files/Metadata-06-02-01.pdf Note: In cases of mismatch between the country report and the internationally agreed guideline, we followed the report. */ clonevar toilet = f1_s1_13 *** Standard MPI *** /*Members of the household are considered deprived if the household's sanitation facility is not improved (according to the SDG guideline) or it is improved but shared with other households*/ ******************************************************************** /*Note: The ENSANUT 2018 recorded 5 categories of toilet facility in the data. The country report (p.24, footnote 24) specifies that toilets with sewer, septic tank and other flush systems as improved. This suggest that all other categories are non-improved, including the category identified as latrine. Please note that vi15b represents the number of toilets that has been exclusively used by the household. If the household has at least one private toilet, we then consider this as non-deprived. */ gen toilet_mdg = 1 if f1_s1_13<5 //Household is assigned a value of '1' if it uses improved sanitation replace toilet_mdg = 0 if f1_s1_13==5 //Household is assigned a value of '0' if it uses unimproved sanitation replace toilet_mdg = 0 if f1_s1_14==1 replace toilet_mdg = 0 if f1_s1_15==2 replace toilet_mdg = 0 if f1_s1_19==1 /*Household is assigned a value of '0' if the facility is shared */ lab var toilet_mdg "Household has improved sanitation with MDG Standards" ta f1_s1_13 toilet_mdg, m ******************************************************************************** *** Step 2.7 Drinking Water *** ******************************************************************************** /* Improved drinking water sources include the following: piped water into dwelling, yard or plot; public taps or standpipes; boreholes or tubewells; protected dug wells; protected springs; packaged water; delivered water and rainwater which is located on premises or is less than a 30-minute walk from home roundtrip. Source: https://unstats.un.org/sdgs/metadata/files/Metadata-06-01-01.pdf Note: In cases of mismatch between the country report and the internationally agreed guideline, we followed the report. */ clonevar water = f1_s1_25 codebook water, tab (99) gen timetowater= f1_s1_27 replace timetowater=. if timetowater==888 tab water if timetowater>=30 & timetowater!=. *** Standard MPI *** /* Members of the household are considered deprived if the household does not have access to improved drinking water (according to the SDG guideline) or safe drinking water is at least a 30-minute walk from home, roundtrip */ ******************************************************************** gen water_mdg = 1 if water==1 | water==2 | water==3 | water==4 | water==5 | water==6 | water==7 | water==9 | water==12 replace water_mdg = 0 if water==8 | water==10 | water==11 | water==13 replace water_mdg = 0 if (timetowater>=30 & timetowater!=.) //Deprived if water is at more than 30 minutes' walk (roundtrip) lab var water_mdg "Household has drinking water with MDG standards (considering distance)" tab water water_mdg, miss /* 25. ¿El agua que se usa para | beber en este hogar principalmente | proviene de: | Freq. Percent Cum. ------------------------------------+----------------------------------- red pública? | 83,768 49.64 49.64 1 y pila o llave pública? | 1,121 0.66 50.31 2 y otra fuente por tubería? | 15,386 9.12 59.42 3 y carro repartidor/triciclo tanquero? | 1,311 0.78 60.20 4 y agua embotellada /envasada? | 44,943 26.63 86.83 5 y agua en funda? | 420 0.25 87.08 6 y pozo entubado/pozo protegido? | 6,537 3.87 90.96 7 y pozo no protegido? | 4,508 2.67 93.63 8 n manantial/vertiente protegida? | 1,425 0.84 94.47 9 y manantial/vertiente no protegida? | 1,523 0.90 95.37 10 n río o acequia? | 4,964 2.94 98.32 11 n recogen agua de la lluvia? | 2,229 1.32 99.64 12 y otro, cuál? | 612 0.36 100.00 13 n ------------------------------------+----------------------------------- Total | 168,747 100.00 */ ******************************************************************************** *** Step 2.8 Housing *** ******************************************************************************** /* Members of the household are considered deprived if the household has a dirt, sand or dung floor */ lookfor piso clonevar floor = f1_s1_4 codebook floor, tab(99) gen floor_imp = 1 if floor<=6 replace floor_imp = 0 if floor==7 | floor==8 lab var floor_imp "Household has floor that it is not earth/sand/dung" tab floor floor_imp, m /* Members of the household are considered deprived if the household has walls made of natural or rudimentary materials */ /*Note: For the purpose of hte global MPI, in the case of Ecuador, we classified "adobe" and "wood" as improved, and cane/coated reed as unimproved.*/ lookfor pared clonevar wall = f1_s1_5 codebook wall, tab(99) gen wall_imp = 1 if wall<=4 replace wall_imp = 0 if wall>=5 & wall<=7 lab var wall_imp "Household has wall that it is not of low quality materials" tab wall wall_imp, m /* Members of the household are considered deprived if the household has walls made of natural or rudimentary materials */ lookfor techo clonevar roof = f1_s1_3 codebook roof, tab(99) gen roof_imp = 1 if roof<=5 replace roof_imp = 0 if roof==5 | roof==6 lab var roof_imp "Household has roof that it is not of low quality materials" tab roof roof_imp, m *** Standard MPI *** /* Members of the household is deprived in housing if the roof, floor OR walls are constructed from low quality materials.*/ ************************************************************** gen housing_1 = 1 replace housing_1 = 0 if floor_imp==0 | wall_imp==0 | roof_imp==0 replace housing_1 = . if floor_imp==. & wall_imp==. & roof_imp==. lab var housing_1 "Household has roof, floor & walls that it is not low quality material" tab housing_1, m ******************************************************************************** *** Step 2.9 Cooking Fuel *** ******************************************************************************** /* Solid fuel are solid materials burned as fuels, which includes coal as well as solid biomass fuels (wood, animal dung, crop wastes and charcoal). Source: https://apps.who.int/iris/bitstream/handle/10665/141496/9789241548885_eng.pdf */ lookfor combustible clonevar cookingfuel = f1_s1_9 *** Standard MPI *** /* Members of the household are considered deprived if the household uses solid fuels and solid biomass fuels for cooking. */ ***************************************************************** gen cooking_mdg = 0 if cookingfuel==2 replace cooking_mdg = 1 if cookingfuel==1 | cookingfuel==3 | cookingfuel==5 lab var cooking_mdg "Househod has cooking fuel according to MDG standards" tab cookingfuel cooking_mdg, miss ******************************************************************************** *** Step 2.10 Assets ownership *** ******************************************************************************** /*Assets that are included in the global MPI: Radio, TV, telephone, bicycle, motorbike, refrigerator, car, computer and animal cart */ * Television /*Note: if the household has a black/white or color TV it is considered not deprived.*/ gen television = f1_s1_44_7 replace television=0 if f1_s1_44_7==2 gen bw_television = . * Radio /*Note: if the household has a radio (radio equipment or sound equipment) it is considered not deprived. */ gen radio = . * Landline gen telephone = f1_s1_44_10 replace telephone= 0 if f1_s1_44_10==2 * Mobile phone gen mobile = f1_s2_23 tab age if f1_s2_23==., m //persons <5 y were not asked and we assume they do not have a cell phone replace mobile = 0 if f1_s2_23==2 | f1_s2_23==. egen mobiletelephone = max(mobile), by(id_hogar) * Refrigerator gen refrigerator = f1_s1_44_1 replace refrigerator = 0 if f1_s1_44_1==2 * Car/truck gen car = f1_s1_44_11 replace car = 0 if f1_s1_44_11==2 * Bicycle gen bicycle = . * Motorcycle gen motorbike = . *Computer gen computer = f1_s1_44_2 replace computer = 0 if f1_s1_44_2==2 gen animal_cart = . foreach var in television radio telephone mobiletelephone refrigerator car bicycle motorbike computer animal_cart { replace `var' = . if `var'==9 | `var'==99 | `var'==8 | `var'==98 } //Replace missing values //Combine information on telephone and mobiletelephone tab telephone mobiletelephone, m replace telephone=1 if mobiletelephone==1 *** Standard MPI *** /* Members of the household are considered deprived in assets if the household does not own more than one of: radio, TV, telephone, bike, motorbike, refrigerator, computer or animal cart and does not own a car or truck.*/ ***************************************************************************** egen n_small_assets2 = rowtotal(television radio telephone refrigerator bicycle motorbike computer animal_cart), missing lab var n_small_assets2 "Household Number of Small Assets Owned" gen hh_assets2 = (car==1 | n_small_assets2 > 1) replace hh_assets2 = . if car==. & n_small_assets2==. lab var hh_assets2 "Household Asset Ownership: HH has car or more than 1 small assets incl computer & animal cart" ******************************************************************************** *** Step 2.11 Rename and keep variables for MPI calculation ******************************************************************************** //Retain data on sampling design: *clonevar strata = dominio *clonevar psu = identif_sect *codebook strata psu //Retain year, month & date of interview: desc fecha_anio fecha_mes fecha_dia clonevar year_interview = fecha_anio clonevar month_interview = fecha_mes clonevar date_interview = fecha_dia //Generate presence of subsample gen subsample = . //Destring hh_id ind_id psu *destring hh_id ind_id psu, replace desc hh_id ind_id upm *** Keep main variables require for MPI calculation *** keep hh_id ind_id subsample upm weight area relationship sex age agec7 agec4 agec2 marital hhsize region no_child_eligible no_nutri_eligible no_fem_eligible no_child_eligible ethnic_hh year_interview month_interview date_interview eduyears no_missing_edu hh_years_edu6 attendance no_missing_atten hh_child_atten underweight stunting wasting age_month low_bmiage low_bmiage hh_nutrition_uw_st child_mortality hh_mortality hh_mortality_5y electricity toilet toilet_mdg water timetowater water_mdg floor wall roof floor_imp wall_imp roof_imp housing_1 cookingfuel cooking_mdg television radio telephone refrigerator car bicycle motorbike animal_cart computer n_small_assets2 hh_assets2 ethnic_hh *** Order file *** order hh_id ind_id subsample upm weight area relationship sex age agec7 agec4 agec2 marital hhsize region no_child_eligible no_nutri_eligible no_fem_eligible no_child_eligible ethnic_hh year_interview month_interview date_interview eduyears no_missing_edu hh_years_edu6 attendance no_missing_atten hh_child_atten underweight stunting wasting age_month low_bmiage low_bmiage hh_nutrition_uw_st child_mortality hh_mortality hh_mortality_5y electricity toilet toilet_mdg water timetowater water_mdg floor wall roof floor_imp wall_imp roof_imp housing_1 cookingfuel cooking_mdg television radio telephone refrigerator car bicycle motorbike animal_cart computer n_small_assets2 hh_assets2 ethnic_hh *** Rename key Global MPI indicators for estimation *** /* Note: In the case of Ecuador ENSANUT 2018, there is no birth history file. We are not able to identify whether child mortality occured in the last 5 years preceeding the survey date. As such, for the estimation, we use the indicator 'hh_mortality' that represent all child mortality that was ever reported. */ recode hh_mortality_5y (0=1)(1=0) , gen(d_cm) recode hh_nutrition_uw_st (0=1)(1=0) , gen(d_nutr) recode hh_child_atten (0=1)(1=0) , gen(d_satt) recode hh_years_edu6 (0=1)(1=0) , gen(d_educ) recode electricity (0=1)(1=0) , gen(d_elct) recode water_mdg (0=1)(1=0) , gen(d_wtr) recode toilet_mdg (0=1)(1=0) , gen(d_sani) recode housing_1 (0=1)(1=0) , gen(d_hsg) recode cooking_mdg (0=1)(1=0) , gen(d_ckfl) recode hh_assets2 (0=1)(1=0) , gen(d_asst) *** Total number of missing values for each variable *** mdesc upm area age d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst gen N = d_cm!=. & d_nutr!=. & d_satt!=. & d_educ!=. & d_elct!=. & d_wtr!=. & d_sani!=. & d_hsg!=. & d_ckfl!=. & d_asst!=. tab N, miss tab N [aw = weight] tab region N [aw = weight], row drop N *** Generate coutry and survey details for estimation *** char _dta[cty] "Ecuador" char _dta[ccty] "ECU" char _dta[year] "2018" char _dta[survey] "ENSANUT" char _dta[ccnum] "218" char _dta[type] "micro" *** Sort, compress and save data for estimation *** sort ind_id compress la da "Micro data for `_dta[ccty]' (`_dta[ccnum]'). Last save: `c(filedate)'." save "$path_out/ecu_ENSANUT2018.dta", replace erase "$path_out/ECU2018_children.dta" use "$path_out\ecu_ENSANUT2018.dta", clear ******************************************************************************** *** Define Sample Weight and total population *** ******************************************************************************** gen sample_weight = weight /* change to weight if MICS*/ ******************************************************************************** *** List of the 10 indicators included in the MPI *** ******************************************************************************** gen edu_1 = hh_years_edu6 gen atten_1 = hh_child_atten gen cm_1 = hh_mortality_5y /* change countries with no child mortality 5 year to child mortality ever*/ gen nutri_1 = hh_nutrition_uw_st gen elec_1 = electricity gen toilet_1 = toilet_mdg gen water_1 = water_mdg gen house_1 = housing_1 gen fuel_1 = cooking_mdg gen asset_1 = hh_assets2 global est_1 edu_1 atten_1 cm_1 nutri_1 elec_1 toilet_1 water_1 house_1 fuel_1 asset_1 ******************************************************************************** *** List of sample without missing values *** ******************************************************************************** foreach j of numlist 1 { qui gen sample_`j' = (edu_`j'!=. & atten_`j'!=. & cm_`j'!=. & nutri_`j'!=. & elec_`j'!=. & toilet_`j'!=. & water_`j'!=. & house_`j'!=. & fuel_`j'!=. & asset_`j'!=.) qui replace sample_`j' = . if subsample==0 /* Note: If the anthropometric data was collected from a subsample of the total population that was sampled, then the final analysis only includes the subsample population. */ *** Percentage sample after dropping missing values *** qui sum sample_`j' [iw = sample_weight] qui gen per_sample_weighted_`j' = r(mean) qui sum sample_`j' qui gen per_sample_`j' = r(mean) } *** ******************************************************************************** *** Define deprivation matrix 'g0' *** which takes values 1 if individual is deprived in the particular *** indicator according to deprivation cutoff z as defined during step 2 *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { qui gen g0`j'_`var' = 1 if `var'==0 qui replace g0`j'_`var' = 0 if `var'==1 } } *** Raw Headcount Ratios foreach j of numlist 1 { foreach var in ${est_`j'} { qui sum g0`j'_`var' if sample_`j'==1 [iw = sample_weight] qui gen raw`j'_`var' = r(mean)*100 lab var raw`j'_`var' "Raw Headcount: Percentage of people who are deprived in `var'" } } ******************************************************************************** *** Define vector 'w' of dimensional and indicator weight *** ******************************************************************************** /*If survey lacks one or more indicators, weights need to be adjusted within / each dimension such that each dimension weighs 1/3 and the indicator weights add up to one (100%). CHECK COUNTRY FILE*/ foreach j of numlist 1 { // DIMENSION EDUCATION foreach var in edu_`j' atten_`j' { capture drop w`j'_`var' qui gen w`j'_`var' = 1/6 } // DIMENSION HEALTH foreach var in cm_`j' nutri_`j' { capture drop w`j'_`var' qui gen w`j'_`var' = 1/6 } // DIMENSION LIVING STANDARD foreach var in elec_`j' toilet_`j' water_`j' house_`j' fuel_`j' asset_`j' { capture drop w`j'_`var' qui gen w`j'_`var' = 1/18 } } ******************************************************************************** *** Generate the weighted deprivation matrix 'w' * 'g0' ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { qui gen w`j'_g0_`var' = w`j'_`var' * g0`j'_`var' qui replace w`j'_g0_`var' = . if sample_`j'!=1 /*The estimation is based only on observations that have non-missing values for all variables in varlist_pov*/ } } ******************************************************************************** *** Generate the vector of individual weighted deprivation count 'c' ******************************************************************************** foreach j of numlist 1 { qui egen c_vector_`j' = rowtotal(w`j'_g0_*) qui replace c_vector_`j' = . if sample_`j'!=1 *drop w_g0_* } ******************************************************************************** *** Identification step according to poverty cutoff k (20 33.33 50) *** ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { qui gen multidimensionally_poor_`j'_`k' = (c_vector_`j'>=`k'/100) qui replace multidimensionally_poor_`j'_`k' = . if sample_`j'!=1 //Takes value 1 if individual is multidimensional poor } } ******************************************************************************** *** Generate the censored vector of individual weighted deprivation count 'c(k)' ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { qui gen c_censured_vector_`j'_`k' = c_vector_`j' qui replace c_censured_vector_`j'_`k' = 0 if multidimensionally_poor_`j'_`k'==0 } //Provide a score of zero if a person is not poor } * ******************************************************************************** *** Define censored deprivation matrix 'g0(k)' *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { qui gen g0`j'_k_`var' = g0`j'_`var' qui replace g0`j'_k_`var' = 0 if multidimensionally_poor_`j'_33==0 qui replace g0`j'_k_`var' = . if sample_`j'!=1 } } ******************************************************************************** *** Generates Multidimensional Poverty Index (MPI), *** Headcount (H) and Intensity of Poverty (A) *** ******************************************************************************** *** Multidimensional Poverty Index (MPI) *** foreach j of numlist 1 { foreach k of numlist 20 33 50 { qui sum c_censured_vector_`j'_`k' [iw = sample_weight] if sample_`j'==1 qui gen MPI_`j'_`k' = r(mean) lab var MPI_`j'_`k' "MPI with k=`k'" } qui sum c_censured_vector_`j'_33 [iw = sample_weight] if sample_`j'==1 qui gen MPI_`j' = r(mean) lab var MPI_`j' "`j' Multidimensional Poverty Index (MPI = H*A): Range 0 to 1" *** Headcount (H) *** qui sum multidimensionally_poor_`j'_33 [iw = sample_weight] if sample_`j'==1 qui gen H_`j' = r(mean)*100 lab var H_`j' "`j' Headcount ratio: % Population in multidimensional poverty (H)" *** Intensity of Poverty (A) *** qui sum c_censured_vector_`j'_33 [iw = sample_weight] if multidimensionally_poor_`j'_33==1 & sample_`j'==1 qui gen A_`j' = r(mean)*100 lab var A_`j' "`j' Intensity of deprivation among the poor (A): Average % of weighted deprivations" *** Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations) *** qui gen temp = 0 qui replace temp = 1 if c_vector_`j'>=0.2 & c_vector_`j'<0.3332 qui replace temp = . if sample_`j'!=1 qui sum temp [iw = sample_weight] qui gen vulnerable_`j' = r(mean)*100 lab var vulnerable_`j' "`j' % Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations)" drop temp *** Population in severe poverty (with intensity 50% or higher) *** qui gen temp = 0 qui replace temp = 1 if c_vector_`j'>0.49 qui replace temp = . if sample_`j'!=1 qui sum temp [iw = sample_weight] qui gen severe_`j' = r(mean)*100 lab var severe_`j' "`j' % Population in severe poverty (with intensity 50% or higher)" drop temp } * *** Censored Headcount *** foreach j of numlist 1 { foreach var in ${est_`j'} { qui sum g0`j'_k_`var' [iw = sample_weight] if sample_`j'==1 qui gen cen`j'_`var' = r(mean)*100 lab var cen`j'_`var' "Censored Headcount: Percentage of people who are poor and deprived in `var'" } } *** Dimensional Contribution *** foreach j of numlist 1 { foreach var in ${est_`j'} { qui gen cont`j'_`var' = (w`j'_`var' * cen`j'_`var')/MPI_`j' if sample_`j'==1 lab var cont`j'_`var' "% Contribution in MPI of indicator..." } } ** The line below produces the variance (inequality among the poor) ** sum c_vector_1 if c_vector_1>=1/3 & c_vector_1<=1 [aw = sample_weight], detail gen var=r(Var) *** Prepare results to export *** *keep country year survey per_sample_weighted* per_sample* MPI* H* A* vulnerable* severe* raw* cen* cont* *gen temp = (_n) *keep if temp==1 *drop temp order MPI_1 H_1 A_1 var severe_1 vulnerable_1 cont1_nutr cont1_cm_1 cont1_edu_1 cont1_atten_1 cont1_fuel_1 cont1_toilet_1 cont1_water_1 cont1_elec_1 cont1_house_1 cont1_asset_1 per_sample_1 per_sample_weighted_1 raw1_nutri_1 raw1_cm_1 raw1_edu_1 raw1_atten_1 raw1_fuel_1 raw1_toilet_1 raw1_water_1 raw1_elec_1 raw1_house_1 raw1_asset_1 cen1_nutri_1 cen1_cm_1 cen1_edu_1 cen1_atten_1 cen1_fuel_1 cen1_toilet_1 cen1_water_1 cen1_elec_1 cen1_house_1 cen1_asset_1 codebook, compact